fix: coupon removal button and duplicate field ID on checkout form (#76)#389
Conversation
- Fix Remove button in order summary not working: the click handler now also resets toggle_discount_code to false, collapsing the coupon input field and properly clearing the applied coupon state (issue #76) - Fix coupon code field not rendering correctly: the toggle checkbox had id='discount_code' (same as the text input), causing a duplicate HTML id='field-discount_code'. Changed toggle id to 'discount_code_checkbox' to eliminate the duplicate and fix label/field association (issue #76) Closes #76
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
Summary
Fixes two bugs reported in issue #76:
Remove button does nothing — The "Remove" link in the order summary only set
discount_code = ''but did not resettoggle_discount_code. This left the coupon input field visible and in an inconsistent state. The fix addstoggle_discount_code = falseto the click handler so the coupon field collapses and the Vue watcher correctly triggerscreate_order()to recalculate totals.Coupon code does not render correctly — The toggle checkbox (
discount_code_checkbox) hadid = 'discount_code', the same as the text input field. This produced a duplicateid="field-discount_code"in the rendered HTML, breaking the<label for="...">association and causing rendering issues. Fixed by giving the toggle its own unique id:discount_code_checkbox.Changes
views/checkout/templates/order-summary/simple.php— extend click handler to also resettoggle_discount_codeinc/checkout/signup-fields/class-signup-field-discount-code.php— fix duplicate HTML id on the toggle checkboxCloses #76